package com.tjetc.service.impl;

import com.tjetc.common.Resp;
import com.tjetc.dao.NoticeMapper;
import com.tjetc.entity.Notice;
import com.tjetc.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public Resp getAllNotice() {
        return Resp.ok().data("noticeList",noticeMapper.selectAllNotice());
    }

    @Override
    public Resp releaseNotice(Notice notice) {
        int isSuc = noticeMapper.addNotice(notice);
        if(isSuc == 1){
            return Resp.ok().data("status","发布成功！");
        }
        return Resp.error().data("status","发布失败！");
    }
}
